<template>
  <div>
    <!-- 父组件传参 -->
    <MyHeader title="鬼师" color="red" bgc="yellow"></MyHeader>
    <!-- 传入数据 数据渲染 -->
    <MyGoods
    v-for="(item,index) in list" :key="index"
    :good="item"
    ></MyGoods>
    <MyFooter :list="list"></MyFooter>
  </div>
</template>

<script>
  import "bootstrap/dist/css/bootstrap.css"
import MyHeader from "./components/MyHeader.vue";
import MyFooter from "./components/MyFooter.vue";
import MyGoods from "./components/MyGoods.vue";
export default {
  data() {
    return {
      list:[]
    }
  },
  created() {
    // 请求数据
    this.$axios({
      method:'GET',
      url:'/api/cart'
    }).then(res=>{
      console.log(res);
      this.list = res.data.list
    }).catch(err=>{
      console.log(err)
    })
  },
  components: {
    MyHeader,
    MyFooter,
    MyGoods,
  },
};
</script>

<style>
</style>